import numpy as np
import mcubes
from PyCmpltrtok.common import rand_name_on_now
import os


def f(x, y, z):
    return x ** 2 + y ** 2


vertices, triangles = mcubes.marching_cubes_func((-10, -10, -10), (10, 10, 10), 100, 100, 100, f, 16)
print('vertices', vertices.shape)
print('triangles', triangles.shape)
xfilename = os.path.splitext(os.path.split(__file__)[1])[0]
mcubes.export_mesh(vertices, triangles, f'_save/{xfilename}.{rand_name_on_now()}.dae', 'MyShpere')
mcubes.export_obj(vertices, triangles, f'_save/{xfilename}.{rand_name_on_now()}.obj')
